import { useEffect, useState } from 'react'
import styles from './index.module.scss'
import ViewMarkdown from './components/ViewMarkdown'

// 参考：https://blog.csdn.net/weixin_44589651/article/details/121044772
export default function Manual() {
  const [md, setMd] = useState('loading...')

  useEffect(() => {
    // 获取 md 文件
    fetch('docs/README.md')
      .then(resp => resp.text())
      .then(txt => setMd(txt))
  }, [])
  return (
    <div className={styles.manual}>
      <h2 className='p10 tac'>使用手册 </h2>
      <ViewMarkdown textContent={md} className='markdown-container' />
    </div>
  )
}
